<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Notification extends MY_Controller {

	function __construct() {
		parent::__construct();
	}
	
	public function index()
	{
		if($this->LoggedIn()){
			$this->load->model("Notification_model");
			//$data['searchresults'] = $this->Notification_model->get_notifications($this->fb_id);
			$data['notification_count'] = $this->Notification_model->get_notification_count($this->fb_id);
			$new_notifications = $this->Notification_model->new_notification_count($this->fb_id);
		
			$data['title'] = 'My Notifications';
			$data['content_view'] = 'notification_view';
			$data['stylesheets'] = array('paginate-style');
			$data['javascripts'] = array('notification');
			$this->load_view($data, TRUE);
		}
	}
	
	function get_notifications()
	{
		$this->load->model("Notification_model");
		$data = $this->Notification_model->get_notifications($this->fb_id, $_POST['page']);
		echo json_encode($data);
	}
}
